package db;

import Dao.BookDao;
import Dao.impl.BookDaoImpl;
import fake.domain.Book.Book;
import utils.RandomUtil;

import java.io.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;

/**
 * @ClassName:DB
 * @Author: 鹿建文
 * @Date: 2022/3/24  - 10:42
 * @Describe:
 */
public class DB {
    private static BookDao bk = new BookDaoImpl();
    public static ArrayList<Book> books = new ArrayList<>(5);

    static {



            for (int i = 0; i < 5; i++) {
                books.add(
                        Book.builder()

                                .isbn(RandomUtil.genInteger(900, 999) + "-" + RandomUtil.genInteger(9900, 9999)+RandomUtil.genInteger(900, 999) + "-" + RandomUtil.genInteger(99000, 99999) + RandomUtil.genInteger(900, 999) + "-" + RandomUtil.genInteger(99000, 99999))
                                .bname(RandomUtil.genString(6, RandomUtil.genInteger(3, 8)))
                                .author(RandomUtil.genChineseName())
                                .date(RandomUtil.genLocalDate("1949-10-1", "2021-12-31"))
                                .press(RandomUtil.genString(6, RandomUtil.genInteger(1, 5)) + "出版社")
                                .price(new BigDecimal(RandomUtil.genInteger(25,150)))

                                .build());
            }


    }




}